﻿using Server.Contract;
using Server.Core.Contract;
using WCFLib;

namespace Server.Core
{
    public class ServerHost
    {
        private readonly HostHelper<IPublishService, ServerService> _publishHost;
        private readonly HostHelper<IUpdateService, ServerService> _updateHost;

        public ServerHost()
        {
            _publishHost =
                new HostHelper<IPublishService, ServerService>("localhost:8080", HostBindingType.TCP_BUFFERERD);

            _updateHost
                = new HostHelper<IUpdateService, ServerService>("localhost:8080", HostBindingType.TCP_BUFFERERD);
        }

        public void Open()
        {
            _publishHost.Open();
            _updateHost.Open();
        }

        public void Close()
        {
            _updateHost.Close();
            _publishHost.Close();
        }
    }
}
